home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / share / aclocal / xorg-macros.m4 < prev    next >
Encoding:
M4 Source File  |  2006-12-20  |  13.2 KB  |  422 lines

  1. dnl
  2. dnl Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
  3. dnl 
  4. dnl Permission is hereby granted, free of charge, to any person obtaining a
  5. dnl copy of this software and associated documentation files (the
  6. dnl "Software"), to deal in the Software without restriction, including
  7. dnl without limitation the rights to use, copy, modify, merge, publish,
  8. dnl distribute, and/or sell copies of the Software, and to permit persons
  9. dnl to whom the Software is furnished to do so, provided that the above
  10. dnl copyright notice(s) and this permission notice appear in all copies of
  11. dnl the Software and that both the above copyright notice(s) and this
  12. dnl permission notice appear in supporting documentation.
  13. dnl
  14. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15. dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
  17. dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  18. dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
  19. dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
  20. dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  21. dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  22. dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  23. dnl
  24. dnl Except as contained in this notice, the name of a copyright holder
  25. dnl shall not be used in advertising or otherwise to promote the sale, use
  26. dnl or other dealings in this Software without prior written authorization
  27. dnl of the copyright holder.
  28.  
  29. # XORG_MACROS_VERSION(required-version)
  30. # -------------------------------------
  31. # Minimum version: 1.1.0
  32. #
  33. # If you're using a macro added in Version 1.1 or newer, include this in
  34. # your configure.ac with the minimum required version, such as:
  35. # XORG_MACROS_VERSION(1.1)
  36. #
  37. # To force at least a version with this macro defined, also add:
  38. # m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])])
  39. #
  40. #
  41. # See the "minimum version" comment for each macro you use to see what 
  42. # version you require.
  43. AC_DEFUN([XORG_MACROS_VERSION],[
  44.     [XORG_MACROS_needed_version=$1
  45.     XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'`
  46.     XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
  47.     AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}])
  48.     [XORG_MACROS_version=1.1.2
  49.     XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'`
  50.     XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
  51.     if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then
  52.         AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x])
  53.     fi
  54.     if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then
  55.         AC_MSG_ERROR([configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer])
  56.     fi
  57.     AC_MSG_RESULT([yes, $XORG_MACROS_version])
  58. ]) # XORG_MACROS_VERSION
  59.  
  60. # XORG_PROG_RAWCPP()
  61. # ------------------
  62. # Minimum version: 1.0.0
  63. #
  64. # Find cpp program and necessary flags for use in pre-processing text files
  65. # such as man pages and config files
  66. AC_DEFUN([XORG_PROG_RAWCPP],[
  67. AC_REQUIRE([AC_PROG_CPP])
  68. AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
  69.    [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
  70.  
  71. # Check for flag to avoid builtin definitions - assumes unix is predefined,
  72. # which is not the best choice for supporting other OS'es, but covers most
  73. # of the ones we need for now.
  74. AC_MSG_CHECKING([if $RAWCPP requires -undef])
  75. AC_LANG_CONFTEST([Does cpp redefine unix ?])
  76. if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
  77.     AC_MSG_RESULT([no])
  78. else
  79.     if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
  80.         RAWCPPFLAGS=-undef
  81.         AC_MSG_RESULT([yes])
  82.     else
  83.         AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
  84.     fi
  85. fi
  86. rm -f conftest.$ac_ext
  87.  
  88. AC_MSG_CHECKING([if $RAWCPP requires -traditional])
  89. AC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
  90. if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
  91.     AC_MSG_RESULT([no])
  92. else
  93.     if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
  94.         RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
  95.         AC_MSG_RESULT([yes])
  96.     else
  97.         AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
  98.     fi
  99. fi
  100. rm -f conftest.$ac_ext
  101. AC_SUBST(RAWCPPFLAGS)
  102. ]) # XORG_PROG_RAWCPP
  103.  
  104. # XORG_MANPAGE_SECTIONS()
  105. # -----------------------
  106. # Minimum version: 1.0.0
  107. #
  108. # Determine which sections man pages go in for the different man page types
  109. # on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
  110. # Not sure if there's any better way than just hardcoding by OS name.
  111. # Override default settings by setting environment variables
  112.  
  113. AC_DEFUN([XORG_MANPAGE_SECTIONS],[
  114. AC_REQUIRE([AC_CANONICAL_HOST])
  115.  
  116. if test x$APP_MAN_SUFFIX = x    ; then
  117.     APP_MAN_SUFFIX=1
  118. fi
  119. if test x$APP_MAN_DIR = x    ; then
  120.     APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
  121. fi
  122.  
  123. if test x$LIB_MAN_SUFFIX = x    ; then
  124.     LIB_MAN_SUFFIX=3
  125. fi
  126. if test x$LIB_MAN_DIR = x    ; then
  127.     LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
  128. fi
  129.  
  130. if test x$FILE_MAN_SUFFIX = x    ; then
  131.     case $host_os in
  132.     solaris*)    FILE_MAN_SUFFIX=4  ;;
  133.     *)        FILE_MAN_SUFFIX=5  ;;
  134.     esac
  135. fi
  136. if test x$FILE_MAN_DIR = x    ; then
  137.     FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
  138. fi
  139.  
  140. if test x$MISC_MAN_SUFFIX = x    ; then
  141.     case $host_os in
  142.     solaris*)    MISC_MAN_SUFFIX=5  ;;
  143.     *)        MISC_MAN_SUFFIX=7  ;;
  144.     esac
  145. fi
  146. if test x$MISC_MAN_DIR = x    ; then
  147.     MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
  148. fi
  149.  
  150. if test x$DRIVER_MAN_SUFFIX = x    ; then
  151.     case $host_os in
  152.     solaris*)    DRIVER_MAN_SUFFIX=7  ;;
  153.     *)        DRIVER_MAN_SUFFIX=4  ;;
  154.     esac
  155. fi
  156. if test x$DRIVER_MAN_DIR = x    ; then
  157.     DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
  158. fi
  159.  
  160. if test x$ADMIN_MAN_SUFFIX = x    ; then
  161.     case $host_os in
  162.     solaris*)    ADMIN_MAN_SUFFIX=1m ;;
  163.     *)        ADMIN_MAN_SUFFIX=8  ;;
  164.     esac
  165. fi
  166. if test x$ADMIN_MAN_DIR = x    ; then
  167.     ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
  168. fi
  169.  
  170.  
  171. AC_SUBST([APP_MAN_SUFFIX])
  172. AC_SUBST([LIB_MAN_SUFFIX])
  173. AC_SUBST([FILE_MAN_SUFFIX])
  174. AC_SUBST([MISC_MAN_SUFFIX])
  175. AC_SUBST([DRIVER_MAN_SUFFIX])
  176. AC_SUBST([ADMIN_MAN_SUFFIX])
  177. AC_SUBST([APP_MAN_DIR])
  178. AC_SUBST([LIB_MAN_DIR])
  179. AC_SUBST([FILE_MAN_DIR])
  180. AC_SUBST([MISC_MAN_DIR])
  181. AC_SUBST([DRIVER_MAN_DIR])
  182. AC_SUBST([ADMIN_MAN_DIR])
  183. ]) # XORG_MANPAGE_SECTIONS
  184.  
  185. # XORG_CHECK_LINUXDOC
  186. # -------------------
  187. # Minimum version: 1.0.0
  188. #
  189. # Defines the variable MAKE_TEXT if the necessary tools and
  190. # files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
  191. # Whether or not the necessary tools and files are found can be checked
  192. # with the AM_CONDITIONAL "BUILD_LINUXDOC"
  193. AC_DEFUN([XORG_CHECK_LINUXDOC],[
  194. XORG_SGML_PATH=$prefix/share/sgml
  195. HAVE_DEFS_ENT=
  196.  
  197. AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
  198.  
  199. AC_PATH_PROG(LINUXDOC, linuxdoc)
  200. AC_PATH_PROG(PS2PDF, ps2pdf)
  201.  
  202. AC_MSG_CHECKING([Whether to build documentation])
  203.  
  204. if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
  205.    BUILDDOC=yes
  206. else
  207.    BUILDDOC=no
  208. fi
  209.  
  210. AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
  211.  
  212. AC_MSG_RESULT([$BUILDDOC])
  213.  
  214. AC_MSG_CHECKING([Whether to build pdf documentation])
  215.  
  216. if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
  217.    BUILDPDFDOC=yes
  218. else
  219.    BUILDPDFDOC=no
  220. fi
  221.  
  222. AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
  223.  
  224. AC_MSG_RESULT([$BUILDPDFDOC])
  225.  
  226. MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
  227. MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
  228. MAKE_PDF="$PS2PDF"
  229. MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
  230.  
  231. AC_SUBST(MAKE_TEXT)
  232. AC_SUBST(MAKE_PS)
  233. AC_SUBST(MAKE_PDF)
  234. AC_SUBST(MAKE_HTML)
  235. ]) # XORG_CHECK_LINUXDOC
  236.  
  237. # XORG_CHECK_DOCBOOK
  238. # -------------------
  239. # Minimum version: 1.0.0
  240. #
  241. # Checks for the ability to build output formats from SGML DocBook source.
  242. # For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
  243. # indicates whether the necessary tools and files are found and, if set,
  244. # $(MAKE_XXX) blah.sgml will produce blah.xxx.
  245. AC_DEFUN([XORG_CHECK_DOCBOOK],[
  246. XORG_SGML_PATH=$prefix/share/sgml
  247. HAVE_DEFS_ENT=
  248. BUILDTXTDOC=no
  249. BUILDPDFDOC=no
  250. BUILDPSDOC=no
  251. BUILDHTMLDOC=no
  252.  
  253. AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
  254.  
  255. AC_PATH_PROG(DOCBOOKPS, docbook2ps)
  256. AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
  257. AC_PATH_PROG(DOCBOOKHTML, docbook2html)
  258. AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
  259.  
  260. AC_MSG_CHECKING([Whether to build text documentation])
  261. if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
  262.    test x$BUILD_TXTDOC != xno; then
  263.     BUILDTXTDOC=yes
  264. fi
  265. AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
  266. AC_MSG_RESULT([$BUILDTXTDOC])
  267.  
  268. AC_MSG_CHECKING([Whether to build PDF documentation])
  269. if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
  270.    test x$BUILD_PDFDOC != xno; then
  271.     BUILDPDFDOC=yes
  272. fi
  273. AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
  274. AC_MSG_RESULT([$BUILDPDFDOC])
  275.  
  276. AC_MSG_CHECKING([Whether to build PostScript documentation])
  277. if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
  278.    test x$BUILD_PSDOC != xno; then
  279.     BUILDPSDOC=yes
  280. fi
  281. AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
  282. AC_MSG_RESULT([$BUILDPSDOC])
  283.  
  284. AC_MSG_CHECKING([Whether to build HTML documentation])
  285. if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
  286.    test x$BUILD_HTMLDOC != xno; then
  287.     BUILDHTMLDOC=yes
  288. fi
  289. AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
  290. AC_MSG_RESULT([$BUILDHTMLDOC])
  291.  
  292. MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
  293. MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
  294. MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
  295. MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
  296.  
  297. AC_SUBST(MAKE_TEXT)
  298. AC_SUBST(MAKE_PS)
  299. AC_SUBST(MAKE_PDF)
  300. AC_SUBST(MAKE_HTML)
  301. ]) # XORG_CHECK_DOCBOOK
  302.  
  303. # XORG_CHECK_MALLOC_ZERO
  304. # ----------------------
  305. # Minimum version: 1.0.0
  306. #
  307. # Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
  308. # malloc(0) returns NULL.  Packages should add one of these cflags to
  309. # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
  310. AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
  311. AC_ARG_ENABLE(malloc0returnsnull,
  312.     AC_HELP_STRING([--enable-malloc0returnsnull],
  313.                [malloc(0) returns NULL (default: auto)]),
  314.     [MALLOC_ZERO_RETURNS_NULL=$enableval],
  315.     [MALLOC_ZERO_RETURNS_NULL=auto])
  316.  
  317. AC_MSG_CHECKING([whether malloc(0) returns NULL])
  318. if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
  319.     AC_RUN_IFELSE([
  320. char *malloc();
  321. char *realloc();
  322. char *calloc();
  323. main() {
  324.     char *m0, *r0, *c0, *p;
  325.     m0 = malloc(0);
  326.     p = malloc(10);
  327.     r0 = realloc(p,0);
  328.     c0 = calloc(0);
  329.     exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
  330. }],
  331.         [MALLOC_ZERO_RETURNS_NULL=yes],
  332.         [MALLOC_ZERO_RETURNS_NULL=no])
  333. fi
  334. AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
  335.  
  336. if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
  337.     MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
  338.     XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
  339.     XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
  340. else
  341.     MALLOC_ZERO_CFLAGS=""
  342.     XMALLOC_ZERO_CFLAGS=""
  343.     XTMALLOC_ZERO_CFLAGS=""
  344. fi
  345.  
  346. AC_SUBST([MALLOC_ZERO_CFLAGS])
  347. AC_SUBST([XMALLOC_ZERO_CFLAGS])
  348. AC_SUBST([XTMALLOC_ZERO_CFLAGS])
  349. ]) # XORG_CHECK_MALLOC_ZERO
  350.  
  351. # XORG_WITH_LINT()
  352. # ----------------
  353. # Minimum version: 1.1.0
  354. #
  355. # Sets up flags for source checkers such as lint and sparse if --with-lint
  356. # is specified.   (Use --with-lint=sparse for sparse.)
  357. # Sets $LINT to name of source checker passed with --with-lint (default: lint)
  358. # Sets $LINT_FLAGS to flags to pass to source checker
  359. # Sets LINT automake conditional if enabled (default: disabled)
  360. #
  361. AC_DEFUN([XORG_WITH_LINT],[
  362.  
  363. # Allow checking code with lint, sparse, etc.
  364. AC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint],
  365.         [Use a lint-style source code checker (default: disabled)])],
  366.         [use_lint=$withval], [use_lint=no])
  367. if test "x$use_lint" = "xyes" ; then
  368.     LINT="lint"
  369. else
  370.     LINT="$use_lint"
  371. fi
  372. if test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then
  373.     case $LINT in
  374.     lint|*/lint)
  375.         case $host_os in
  376.         solaris*)
  377.             LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
  378.             ;;
  379.         esac
  380.         ;;
  381.     esac
  382. fi
  383.  
  384. AC_SUBST(LINT)
  385. AC_SUBST(LINT_FLAGS)
  386. AM_CONDITIONAL(LINT, [test x$LINT != xno])
  387.  
  388. ]) # XORG_WITH_LINT
  389.  
  390. # XORG_LINT_LIBRARY(LIBNAME)
  391. # --------------------------
  392. # Minimum version: 1.1.0
  393. #
  394. # Sets up flags for building lint libraries for checking programs that call
  395. # functions in the library.
  396. # Disabled by default, enable with --enable-lint-library
  397. # Sets: 
  398. #    @LINTLIB@        - name of lint library file to make
  399. #    MAKE_LINT_LIB        - automake conditional
  400. #
  401.  
  402. AC_DEFUN([XORG_LINT_LIBRARY],[
  403. AC_REQUIRE([XORG_WITH_LINT])
  404. # Build lint "library" for more indepth checks of programs calling this library
  405. AC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library],
  406.     [Create lint library (default: disabled)])],
  407.     [make_lint_lib=$enableval], [make_lint_lib=no])
  408. if test "x$make_lint_lib" != "xno" ; then
  409.     if test "x$LINT" = "xno" ; then
  410.         AC_MSG_ERROR([Cannot make lint library without --with-lint])
  411.     fi
  412.     if test "x$make_lint_lib" = "xyes" ; then
  413.         LINTLIB=llib-l$1.ln
  414.     else
  415.         LINTLIB=$make_lint_lib
  416.     fi
  417. fi
  418. AC_SUBST(LINTLIB)
  419. AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
  420.  
  421. ]) # XORG_LINT_LIBRARY
  422.